/**
 * 人事-异动管理接口
 */
import { ajaxService } from '@/utils/request';
import * as interfaceObj from './type';

const env = import.meta.env;
// const baseURL = 'http://192.168.31.129:39001';
const baseURL = env.VITE_APP_BASE_URL;

/**
 * 新增实习生模板
 * @param data
 * @returns
 */
export function PostInternshipTemplate(data: interfaceObj.TInternshipTemplate) {
  return ajaxService({
    url: '/internship/template/selfService/add',
    method: 'post',
    baseURL,
    data
  });
}

/**
 * 获取实习生模板列表
 * @returns
 */
export function GetInternshipTemplateList() {
  return ajaxService<interfaceObj.TEditInternshipTemplate[]>({
    url: '/internship/template/selfService/getAll',
    method: 'get',
    baseURL
  });
}
/**
 * 通过id获取实习生模板信息
 * @param data
 * @returns
 */
export function GetInternshipTemplateById(params: { id: number }) {
  return ajaxService({
    url: '/internship/template/selfService/get',
    method: 'get',
    baseURL,
    params
  });
}

/**
 * 通过id删除实习生模板
 * @param data
 * @returns
 */
export function DelInternshipTemplateById(data: { id: number }) {
  return ajaxService({
    url: '/internship/template/selfService/del',
    method: 'delete',
    baseURL,
    data
  });
}

/**
 * 编辑实习生模板信息
 * @param data
 * @returns
 */
export function PutInternshipTemplate(
  data: interfaceObj.TEditInternshipTemplate
) {
  return ajaxService({
    url: '/internship/template/selfService/mod',
    method: 'post',
    baseURL,
    data
  });
}
/**
 * 打开实习生模板，会自动关闭已开状态的模板
 * @param data
 * @returns
 */
export function PostInternshipTemplateStatusOpen(data: { id: number }) {
  return ajaxService({
    url: '/internship/template/selfService/statusOpen',
    method: 'post',
    baseURL,
    data
  });
}
/**
 * 获取实习证明开具方式内容
 * @returns
 */
export function GetInternshipProofMode() {
  return ajaxService({
    url: '/internship/getInternshipCertificateType',
    method: 'get',
    baseURL
  });
}
/**
 * 修改实习证明开具方式
 * @param data
 * @returns
 */
export function PostInternshipProofMode(data: { value: string }) {
  return ajaxService({
    url: '/internship/setInternshipCertificateType',
    method: 'post',
    baseURL,
    data
  });
}
/**
 * 新增实习证明模板审核制
 * @param data
 * @returns
 */
export function PostInternshipProofModeAudit(
  data: interfaceObj.TInternshipTemplateAudit
) {
  return ajaxService({
    url: '/internship/template/audit/add',
    method: 'post',
    baseURL,
    data
  });
}
/**
 * 编辑实习证明模板审核制
 * @param data
 * @returns
 */
export function PutInternshipProofModeAudit(
  data: interfaceObj.TInternshipTemplateAudit
) {
  return ajaxService({
    url: '/internship/template/audit/mod',
    method: 'post',
    baseURL,
    data
  });
}
/**
 * 获取实习证明审核制模板列表
 * @returns
 */
export function GetInternshipProofModeAuditList() {
  return ajaxService({
    url: '/internship/template/audit/getAll',
    method: 'get',
    baseURL
  });
}
/**
 * 通过id获取实习证明模板审核制信息
 * @param data
 * @returns
 */
export function GetInternshipProofModeAuditById(params: { id: number }) {
  return ajaxService({
    url: '/internship/template/audit/get',
    method: 'get',
    baseURL,
    params
  });
}
/**
 * 通过id删除实习证明模板审核制信息
 * @param data
 * @returns
 */
export function DelInternshipProofModeAuditById(data: { id: number }) {
  return ajaxService({
    url: '/internship/template/audit/del',
    method: 'delete',
    baseURL,
    data
  });
}
/**
 * 打开实习证明模板审核制
 * @param data
 * @returns
 */
export function PostInternshipTemplateAuditStatusOpen(data: { id: number }) {
  return ajaxService({
    url: 'internship/template/audit/statusOpen',
    method: 'post',
    baseURL,
    data
  });
}
